package com.fz.controller;

import com.fz.dao.BookDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by webrx on 2017-09-12.
 */
@Controller
public class BookController {

    @Autowired
    protected BookDAO bdao;


    @RequestMapping("/xianshi") @ResponseBody  //直接输出执行，不跳转视图
    public void show(){
        System.out.println(bdao.queryById(6));
    }

    @RequestMapping("/show")
    public String shows(Model m){
        m.addAttribute("book",bdao.queryById(6));
        return "show";
    }



}
